package priv.mill.xml;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.stereotype.Component;

import priv.xml.Person;
@Configuration
@ImportResource(locations="classpath:app.cfg.xml")
@Import(MyConfig1.class)
public class Main {
	
	@SuppressWarnings("resource")
	public static void main(String[] args) {
		AnnotationConfigApplicationContext context = 
				new AnnotationConfigApplicationContext(Main.class);
//				new FileSystemXmlApplicationContext("classpath:app.cfg.xml");
		
		Date date =(Date) context.getBean("HongKong_back_day");

		Person person = context.getBean(Person.class);
		
		SimpleDateFormat format = context.getBean(SimpleDateFormat.class);
		System.out.println(date);

		System.out.println(person);
		
		System.out.println(context.getBean(Cat.class));
		System.out.println(format.format(date));
		
		Calendar bean = context.getBean(Calendar.class);
		System.out.println(bean.getClass());
		
		System.out.println(context.getBean(MouMou.class));
	}

}
